package whisper.service.user.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import whisper.common.support.response.WebResponse;
import whisper.support.user.service.UserService;

import java.util.List;

/**
 * Created by JT on 2018/6/9
 */
@RestController
@RequestMapping("/whisper/users")
public class UserController {

    @Autowired
    private UserService userService;

    @GetMapping
    public WebResponse listUsers() {
        List users = userService.listUsers();
        return new WebResponse().ok("获取用户列表成功!").withData(users);
    }

    @PostMapping
    public WebResponse addUser() {
        return new WebResponse().ok();
    }

    @PutMapping("/{id}")
    public WebResponse modifyUser() {
        return new WebResponse().ok();
    }

    @DeleteMapping("/{id}")
    public WebResponse deleteUser() {
        return new WebResponse().ok();
    }

    @GetMapping("/{id}")
    public WebResponse user() {
        return new WebResponse().ok();
    }
}
